const Mock = require('mockjs')

const data = Mock.mock({
  'items|30': [{
    index: '@increment',
    userneme:   () => {                                                             
        const randomLength = Mock.Random.integer(2, 3);
        let chineseCharacters = '';
        for (let i = 0; i < randomLength; i++) {
            chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
        }
        return chineseCharacters;
    },   //用户名 
    telephone:  '@string("number", 11)',   //电话
    role:  '@pick(["系统调试员", "系统集成员", "系统管理员", "系统查看员"])',     //角色
    associated_item:  '@pick(["节能管理", "能耗监测", "能碳监测", "智慧运维"])',   //关联项目
  }],
});


const treeData = [
  {
    id: 1,
    label: '项目总览',
    children: [
      {
        id: 3,
        label: '集中监测',
        children: [
          {
            id: 4,
            label: '项目监测'
          },
        ]
      },
    ]
  },
  {
    id: 2,
    label: '节能管理平台前端应用',
    children: [
      {
        id: 3,
        label: '综合概览',
        children: [
          {
            id: 4,
            label: '三级 3-1-1'
          },
          {
            id: 5,
            label: '三级 3-1-2',
            disabled: true
          }
        ]
      },
      {
        id: 2,
        label: '智慧动力',
        disabled: true,
        children: [
          {
            id: 6,
            label: '机房监控',
            children:[
              {
                id: 5,
                label: '三级 3-1-2',
                disabled: true
              }
            ]
          },
       
        ]
      }
    ]
  }
];
const defaultProps = {
  children: 'children',
  label: 'label'
}







module.exports = [
  {
    url: '/vue-admin-template/backstage',
    type: 'get',
    response: config => {
      const items = data.items
      return {
        code: 20000,
        data: {
          total: items.length,
          items: items,
          treeData: treeData,
          defaultProps:defaultProps
        }
      }
    }
  },
]
